home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / misc / libx11inc.lha / X11 / Xm / TextStrSoP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-13  |  7.8 KB  |  258 lines

  1. /* 
  2.  * (c) Copyright 1989, 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC.
  3.  * ALL RIGHTS RESERVED
  4. */ 
  5. /*   $RCSfile: TextStrSoP.h,v $ $Revision: 1.32 $ $Date: 92/07/10 11:57:22 $ */
  6. /*
  7. *  (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  8. /*
  9. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  10. #ifndef _XmTextStrSoP_h
  11. #define _XmTextStrSoP_h
  12.  
  13. #include <Xm/XmP.h>
  14. #include <Xm/Text.h>
  15.  
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19.  
  20. /****************************************************************
  21.  *
  22.  * Definitions for use by sources and source users.
  23.  *
  24.  ****************************************************************/
  25.  
  26. typedef enum {EditDone, EditError, EditReject} XmTextStatus;
  27.  
  28. typedef enum {XmsdLeft, XmsdRight} XmTextScanDirection;
  29.     
  30. typedef struct _XmSourceDataRec {
  31.     XmTextSource source;    /* Backpointer to source record. */
  32.     XmTextWidget *widgets;    /* Array of widgets displaying this source. */
  33.     XmTextPosition left, right; /* Left and right extents of selection. */
  34.     char * ptr;            /* Actual string data. */
  35.     char * value;        /* Value of the string data. */
  36.     char * gap_start;        /* Gapped buffer start pointer */
  37.     char * gap_end;        /* Gapped buffer end pointer */
  38.     char * PSWC_NWLN;           /* Holder for char*, short*, int* rep of NWLN */
  39.     int length;            /* Number of chars of data. */
  40.     int maxlength;        /* Space allocated. */
  41.     int old_length;        /* Space allocated for value pointer. */
  42.     int numwidgets;        /* Number of entries in above. */
  43.     int maxallowed;        /* The user is not allowed to grow source */
  44.                 /* to a size greater than this. */
  45.     Time prim_time;             /* time of primary selection */
  46.     Boolean hasselection;    /* Whether we own the selection. */
  47.     Boolean editable;        /* Whether we allow any edits. */
  48. } XmSourceDataRec, *XmSourceData;
  49.  
  50. #ifdef _NO_PROTO
  51. typedef void (*AddWidgetProc)(); /* source, widget */
  52. #else
  53. typedef void (*AddWidgetProc)(
  54.             XmTextSource,
  55.             XmTextWidget);
  56. #endif
  57.  
  58. #ifdef _NO_PROTO
  59. typedef int (*CountLinesProc)(); /* source, start, length */
  60. #else
  61. typedef int (*CountLinesProc)(
  62.              XmTextSource,
  63.              XmTextPosition,
  64.              unsigned long);
  65. #endif
  66.  
  67. #ifdef _NO_PROTO
  68. typedef void (*RemoveWidgetProc)(); /* source, widget */
  69. #else
  70. typedef void (*RemoveWidgetProc)(
  71.             XmTextSource,
  72.             XmTextWidget);
  73. #endif
  74.  
  75. #ifdef _NO_PROTO
  76. typedef XmTextPosition (*ReadProc)(); /* source, position,
  77.                      last_position, block */
  78. #else
  79. typedef XmTextPosition (*ReadProc)(
  80.             XmTextSource,
  81.             XmTextPosition,    /* starting position */
  82.             XmTextPosition,    /* The last position we're interested in.
  83.                       Don't return info about any later
  84.                    positions. */
  85.             XmTextBlock);    /* RETURN: text read in */
  86. #endif
  87.  
  88. #ifdef _NO_PROTO
  89. typedef XmTextStatus (*ReplaceProc)(); /* initiator, event, start, end, block,
  90.                       call_callbacks_flag */
  91. #else
  92. typedef XmTextStatus (*ReplaceProc)(
  93.             XmTextWidget,
  94.             XEvent *,
  95.             XmTextPosition *,
  96.             XmTextPosition *,
  97.             XmTextBlock,
  98. #if NeedWidePrototypes
  99.                 int);
  100. #else
  101.             Boolean); /* call value_changed and modify_verify callbacks? */
  102. #endif
  103. #endif
  104.  
  105. #ifdef _NO_PROTO
  106. typedef XmTextPosition (*ScanProc)(); /* source, pos, sType, dir, 
  107.                      count, include */
  108. #else
  109. typedef XmTextPosition (*ScanProc)(
  110.             XmTextSource,
  111.             XmTextPosition,
  112.             XmTextScanType,
  113.             XmTextScanDirection,    /* Either XmsdLeft or XmsdRight. */
  114.             int,
  115. #if NeedWidePrototypes
  116.                 int);
  117. #else
  118.             Boolean);
  119. #endif /* NeedsWidePrototypes */
  120. #endif
  121.  
  122. #ifdef _NO_PROTO
  123. typedef Boolean (*GetSelectionProc)(); /* source, left, right */
  124. #else
  125. typedef Boolean (*GetSelectionProc)(
  126.             XmTextSource,
  127.             XmTextPosition *,
  128.             XmTextPosition *);
  129. #endif
  130.  
  131. #ifdef _NO_PROTO
  132. typedef void (*SetSelectionProc)(); /* source, left, right, time */
  133. #else
  134. typedef void (*SetSelectionProc)(
  135.             XmTextSource,
  136.             XmTextPosition,
  137.             XmTextPosition,
  138.             Time);
  139. #endif
  140.  
  141.  
  142. typedef struct _XmTextSourceRec {
  143.     struct _XmSourceDataRec *data;   /* Source-defined data (opaque type). */
  144.     AddWidgetProc    AddWidget;
  145.     CountLinesProc    CountLines;
  146.     RemoveWidgetProc    RemoveWidget;
  147.     ReadProc        ReadSource;
  148.     ReplaceProc        Replace;
  149.     ScanProc        Scan;
  150.     GetSelectionProc    GetSelection;
  151.     SetSelectionProc    SetSelection;
  152. } XmTextSourceRec;
  153.  
  154.  
  155. /********    Private Function Declarations    ********/
  156. #ifdef _NO_PROTO
  157.  
  158. extern char * _XmStringSourceGetString() ;
  159. extern Boolean _XmTextFindStringBackwards() ;
  160. extern Boolean _XmTextFindStringForwards() ;
  161. extern Boolean _XmStringSourceFindString() ;
  162. extern void _XmStringSourceSetGappedBuffer() ;
  163. extern Boolean _XmTextModifyVerify() ;
  164. extern XmTextSource _XmStringSourceCreate() ;
  165. extern void _XmStringSourceDestroy() ;
  166. extern char * _XmStringSourceGetValue() ;
  167. extern void _XmStringSourceSetValue() ;
  168. extern Boolean _XmStringSourceHasSelection() ;
  169. extern Boolean _XmStringSourceGetEditable() ;
  170. extern void _XmStringSourceSetEditable() ;
  171. extern int _XmStringSourceGetMaxLength() ;
  172. extern void _XmStringSourceSetMaxLength() ;
  173.  
  174. #else
  175.  
  176. extern char * _XmStringSourceGetString( 
  177.                         XmTextWidget tw,
  178.                         XmTextPosition from,
  179.                         XmTextPosition to,
  180. #if NeedWidePrototypes
  181.                         int want_wchar) ;
  182. #else
  183.                         Boolean want_wchar) ;
  184. #endif /* NeedWidePrototypes */
  185. extern Boolean _XmTextFindStringBackwards( 
  186.                         Widget w,
  187.                         XmTextPosition start,
  188.                         char *search_string,
  189.                         XmTextPosition *position) ;
  190. extern Boolean _XmTextFindStringForwards( 
  191.                         Widget w,
  192.                         XmTextPosition start,
  193.                         char *search_string,
  194.                         XmTextPosition *position) ;
  195. extern Boolean _XmStringSourceFindString( 
  196.                         Widget w,
  197.                         XmTextPosition start,
  198.                         char *string,
  199.                         XmTextPosition *position) ;
  200. extern void _XmStringSourceSetGappedBuffer( 
  201.                         XmSourceData data,
  202.                         XmTextPosition position) ;
  203. extern Boolean _XmTextModifyVerify(
  204.             XmTextWidget initiator,
  205.                 XEvent *event,
  206.                 XmTextPosition *start,
  207.                 XmTextPosition *end,
  208.                 XmTextPosition *cursorPos,
  209.                 XmTextBlock block,
  210.                 XmTextBlock newblock,
  211.             Boolean *freeBlock) ;
  212. extern XmTextSource _XmStringSourceCreate( 
  213.                         char *value,
  214. #if NeedWidePrototypes
  215.                         int is_wchar) ;
  216. #else
  217.                         Boolean is_wchar) ;
  218. #endif /* NeedWidePrototypes */
  219. extern void _XmStringSourceDestroy( 
  220.                         XmTextSource source) ;
  221. extern char * _XmStringSourceGetValue( 
  222.                         XmTextSource source,
  223. #if NeedWidePrototypes
  224.                         int want_wchar) ;
  225. #else
  226.                         Boolean want_wchar) ;
  227. #endif /* NeedWidePrototypes */
  228. extern void _XmStringSourceSetValue( 
  229.                         XmTextWidget widget,
  230.                         char *value) ;
  231. extern Boolean _XmStringSourceHasSelection( 
  232.                         XmTextSource source) ;
  233. extern Boolean _XmStringSourceGetEditable( 
  234.                         XmTextSource source) ;
  235. extern void _XmStringSourceSetEditable( 
  236.                         XmTextSource source,
  237. #if NeedWidePrototypes
  238.                         int editable) ;
  239. #else
  240.                         Boolean editable) ;
  241. #endif /* NeedWidePrototypes */
  242. extern int _XmStringSourceGetMaxLength( 
  243.                         XmTextSource source) ;
  244. extern void _XmStringSourceSetMaxLength( 
  245.                         XmTextSource source,
  246.                         int max) ;
  247.  
  248. #endif /* _NO_PROTO */
  249. /********    End Private Function Declarations    ********/
  250.  
  251.  
  252. #ifdef __cplusplus
  253. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  254. #endif
  255.  
  256. #endif /*  _XmTextStrSoP_h */
  257. /* DON'T ADD ANYTHING AFTER THIS #endif */
  258.